//
//  WYSectionView.m
//  Boss
//
//  Created by admin on 2018/6/22.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYSectionView.h"

@implementation WYSectionView
-(instancetype)init
{
    if (self = [super init]) {
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews
{
    
    UIView *leftView = [[UIView alloc]init];
    [self addSubview:leftView];
    [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.height.mas_equalTo(18);
        make.width.mas_equalTo(0);
        make.top.mas_equalTo(13);
        make.bottom.mas_equalTo(-13);
    }];
    leftView.backgroundColor = kColorMainColor;
    
    
    UILabel *textLabel = [[UILabel alloc]init];
    self.textLabel = textLabel;
    [self addSubview:textLabel];
    [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.left.mas_equalTo(16);
    }];
    textLabel.text = @"品牌专区";
    textLabel.font = kFontSystemBIgger2(16);
    textLabel.textColor = [UIColor hexStringToColor:@"#222222" alpha:1.0];
    
    UIImageView *rightImageView = [[UIImageView alloc]init];
    [self addSubview:rightImageView];
    [rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(-16);
        make.centerY.mas_equalTo(self);
        make.width.mas_equalTo(7);
        make.height.mas_equalTo(12);
        
    }];
    rightImageView.image = [UIImage imageNamed:@"right"];
    self.moreImageView = rightImageView;
    UILabel *moreLabel = [[UILabel alloc]init];
    self.moreLabel = moreLabel;
    [self addSubview:moreLabel];
    [moreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.right.equalTo(rightImageView.mas_left).offset(-5);
    }];
    moreLabel.textColor = kColor999999;
    moreLabel.text = @"更多";
    moreLabel.font = [UIFont systemFontOfSize:14];
    
    UIButton *morebtn = [[UIButton alloc]init];
    [self addSubview:morebtn];
    [morebtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.right.mas_equalTo(0);
        make.left.equalTo(moreLabel.mas_left).offset(-5);
    }];
    //morebtn.backgroundColor = [UIColor redColor];
    
    [morebtn addTarget:self action:@selector(clickMore:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)clickMore:(UIButton *)btn
{
    if ([self.delegate respondsToSelector:@selector(clickMoreButtonAction:)]) {
        [self.delegate clickMoreButtonAction:btn];
    }
    
    
    NSLog(@"1123123113131");
}
@end
